package com.site.controller.manage;

import com.common.controller.BaseController;
import com.common.encryt.MD5;
import com.common.util.SecreUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * Created by robin on 2016/12/12.
 * 基本页面
 */
@Controller
@RequestMapping(value = "manage")
public class IndexController extends BaseController{
    @RequestMapping("login")
    public ModelAndView login(Model model){
        if(SecurityUtils.getSubject().isAuthenticated())return new ModelAndView("redirect:"+this.basePath()+"manage/index");
        return new ModelAndView("manage/login");
    }

    @RequestMapping("index")
    public String index(Model model){
        model.addAttribute("userName",SecreUtil.getUserName());
        return "manage/index";
    }

    @RequestMapping("home")
    public String content(){
        return "manage/main";
    }

    @RequestMapping("icon")
    public String icon(){
        return "manage/system/icon";
    }

}
